package com.proactive.webapp.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.proactive.webapp.dao.MenuDAO;
import com.proactive.webapp.entity.Activity;
import com.proactive.webapp.entity.ActivityImage;
import com.proactive.webapp.entity.Menu;
import com.proactive.webapp.util.MenuUtil;

@Controller
public class PageController {
	ApplicationContext context =  new ClassPathXmlApplicationContext("spring-module.xml");
	@RequestMapping(value = "/error", method = RequestMethod.GET)
	public ModelAndView modiActivityCont(Activity activity, ActivityImage activityImage, HttpSession session){
		ModelAndView model = new ModelAndView("page404");
		List<Menu> menuList = MenuUtil.getList(((MenuDAO)context.getBean("menuDAO")).getList(), 0);
		model.addObject("menuList", menuList);
		return model;
	}
}
